#!/bin/bash

if [ ! -f $PWD/hfile ]
then
`awk 'BEGIN{
	FS = ",";
	OFS= ",";
	sum1=0;
	sum2=0;
}
{
	if($0 !~ /#/)
	{
		a=substr($2,4,3);
		if((NR-1)%14)
		{
			if(a <=790)
			  sum1+=$3/8000;
			else
			  sum2+=$3/8000;				
		}
		else{
			len=length($1)-3;
			$1=substr($1,1,len);
			sum2+=$3/8000;
			perf1[$1]=sum1/6;
			perf2[$1]=sum2/8;
			perf[$1]=(sum1+sum2)/14;
			sum1=0;
			sum2=0;
		}

	}
}
END{
	  for(i in perf)
	  {
			printf("%10s,%2.2f,%2.2f,%2.2f\n", i,perf1[i]*100,perf2[i]*100,perf[i]*100);
	  }
}' $PWD/hfile_vc*.log |sort -n  -t ',' -k1,1n > $PWD/perfall-bc57`
fi


